#========================================================================
#
# Splash library Makefile
#
# Copyright 2003 Glyph & Cog, LLC
#
#========================================================================
# includes basic building rules
# REL_ADDR has to be defined, because Makefile.rules refers 
# to the Makefile.flags
REL_ADDR = ../../../
include $(REL_ADDR)/Makefile.rules

CFLAGS   += $(EXTRA_XPDF_CFLAGS)
CXXFLAGS += $(EXTRA_XPDF_CXXFLAGS)

CXX_SRC = \
	Splash.cc \
	SplashBitmap.cc \
	SplashClip.cc \
	SplashFTFont.cc \
	SplashFTFontEngine.cc \
	SplashFTFontFile.cc \
	SplashFont.cc \
	SplashFontEngine.cc \
	SplashFontFile.cc \
	SplashFontFileID.cc \
	SplashPath.cc \
	SplashPattern.cc \
	SplashScreen.cc \
	SplashState.cc \
	SplashT1Font.cc \
	SplashT1FontEngine.cc \
	SplashT1FontFile.cc \
	SplashXPath.cc \
	SplashXPathScanner.cc

HEADERS = \
	Splash.h\
	SplashBitmap.h\
	SplashClip.h\
	SplashErrorCodes.h\
	SplashFTFont.h\
	SplashFTFontEngine.h\
	SplashFTFontFile.h\
	SplashFont.h\
	SplashFontEngine.h\
	SplashFontFile.h\
	SplashFontFileID.h\
	SplashGlyphBitmap.h\
	SplashMath.h\
	SplashPath.h\
	SplashPattern.h\
	SplashScreen.h\
	SplashState.h\
	SplashT1Font.h\
	SplashT1FontEngine.h\
	SplashT1FontFile.h\
	SplashTypes.h\
	SplashXPath.h\
	SplashXPathScanner.h\

#------------------------------------------------------------------------
SPLASH_OBJS = \
	Splash.o \
	SplashBitmap.o \
	SplashClip.o \
	SplashFTFont.o \
	SplashFTFontEngine.o \
	SplashFTFontFile.o \
	SplashFont.o \
	SplashFontEngine.o \
	SplashFontFile.o \
	SplashFontFileID.o \
	SplashPath.o \
	SplashPattern.o \
	SplashScreen.o \
	SplashState.o \
	SplashT1Font.o \
	SplashT1FontEngine.o \
	SplashT1FontFile.o \
	SplashXPath.o \
	SplashXPathScanner.o

TARGET = $(LIBPREFIX)splash.a
all: $(TARGET)

staticlib: all

$(TARGET): deps $(SPLASH_OBJS)
	$(DEL_FILE) $(TARGET)
	$(AR) $(TARGET) $(SPLASH_OBJS)
	$(RANLIB) $(TARGET)

.PHONY: install-dev uninstall-dev
install-dev: staticlib $(DEV_CONFIG)
	$(MKDIR) $(INSTALL_ROOT)$(INCLUDE_PATH)/splash
	$(COPY_FILE) $(HEADERS) $(INSTALL_ROOT)$(INCLUDE_PATH)/splash
	$(MKDIR) $(INSTALL_ROOT)$(LIB_PATH)/splash
	$(COPY_FILE) $(TARGET) $(INSTALL_ROOT)$(LIB_PATH)/splash

uninstall-dev:
	cd $(INSTALL_ROOT)$(INCLUDE_PATH)/splash && $(DEL_FILE) $(HEADERS)
	$(DEL_DIR)  $(INSTALL_ROOT)$(INCLUDE_PATH)/splash/
	cd $(INSTALL_ROOT)$(LIB_PATH)/splash && $(DEL_FILE) $(TARGET)
	$(DEL_DIR)  $(INSTALL_ROOT)$(LIB_PATH)/splash/
#------------------------------------------------------------------------

clean:
	$(DEL_FILE) $(SPLASH_OBJS) $(TARGET) deps

#------------------------------------------------------------------------

deps: $(HEADERS)
	-$(CXX) $(MANDATORY_INCPATH) -M -MF deps $(CXX_SRC)

# This requires GNU make (or compatible) because deps file doesn't
# exist in time when invoked for the first time and thus has to
# be generated
include deps
